#include "input_voice.h"
#include "input_sys.h"
#include "driver_uart.h"
#include "input_queue.h"
#include <string.h>
#include <stdio.h>

static void SU03TGetInputDataCallBack(int *scr)
{ 
    inputEvent iEvent;
    printf("src:%X %X %X %X %X %X\r\n", scr[0], scr[1], scr[2], scr[3], scr[4], scr[5]);
    if((scr[0] == 0xAA) && (scr[1] == 0x55) && (scr[4] == 0x55) && (scr[5] == 0xAA))
    {
        if(scr[2] != 0x30)
        {
            iEvent.iType = Type_Voice;
            iEvent.sVal = scr[2];
            PutInputEvent(&iEvent);
            printf("%s:%s:%d\r\n", __FILE__, __FUNCTION__, __LINE__);
        }            
    }   
}


static int VoiceInit(void)
{
   GetVoiceDataFromISR(SU03TGetInputDataCallBack);
   return PDSUCCESS;
}


static inputDevice idvoice = {
    .name = "VOICE",
    .Init = VoiceInit,
    .next = NULL
};


void VoiceAdd(void)
{
    InDevListIns(&idvoice);
}

